using System.Numerics;
using System.Diagnostics;
using UnityEngine;
using UnityEditor;

using Vector2 = UnityEngine.Vector2;
using Debug = UnityEngine.Debug;


namespace MeEditorFramework
{
    public class GUILayoutAPI
    {
        
        private string mTextFieldValue;
        private string mTextFieldAreaValue;
        private string mTextPasswordValue = "";
        private Vector2 mPositonScrollview;
        private float mSliderValue;
        private int mToolbarIndex = 0;
        private bool mToggleValue;
        private int mSelectionGridValue = 0;
        public void Draw(){
            // 添加Label 
            GUILayout.Label("Label:Hello GUILayout");

            mPositonScrollview = GUILayout.BeginScrollView(mPositonScrollview);
            {

                
                GUILayout.BeginVertical("Box");
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("TextField:");
                        mTextFieldValue = GUILayout.TextField(mTextFieldValue);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("TextArea:");
                        mTextFieldAreaValue = GUILayout.TextArea(mTextFieldAreaValue);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("PasswordField:");
                        mTextPasswordValue = GUILayout.PasswordField(mTextPasswordValue,'*');
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        // 按钮
                        GUILayout.Label("Button:");
                        GUILayout.FlexibleSpace();
                        if(GUILayout.Button("Button")){
                            UnityEngine.Debug.Log("Button clicked>>>");
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("RepeatButton:");
                        GUILayout.FlexibleSpace();
                        if(GUILayout.RepeatButton("RepeatButton")){
                            UnityEngine.Debug.Log("RepeatButton clicked>>>");
                        }
                    }
                    GUILayout.EndHorizontal();
                    // Box
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Box:");
                        GUILayout.Box("AutoLayout Box");
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("HorzontalSlider:");
                        mSliderValue = GUILayout.HorizontalSlider(mSliderValue,0,1);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("VerticalSlider:");
                        mSliderValue = GUILayout.VerticalSlider(mSliderValue,0,1);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginArea(new Rect(0,0,200,200));
                    {
                        GUI.Label(new Rect(0,0,100,100),"Area:");
                    }
                    GUILayout.EndArea();
 
                    GUILayout.BeginHorizontal();
                    {
                       GUILayout.Label("Toolbar:");
                       mToolbarIndex = GUILayout.Toolbar(mToolbarIndex,new []{"1","2","3"});
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Toggle:");
                        GUILayout.FlexibleSpace();
                        mToggleValue = GUILayout.Toggle(mToggleValue,"toggle");
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.Label("SelectionGrid:");
                    GUILayout.BeginHorizontal();
                    {
                        mSelectionGridValue = GUILayout.SelectionGrid(mSelectionGridValue,new []{"1","2","3","4","5","6"},2);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndScrollView();
          
        }
    }
}